package com.byt.framlib.baseadapter.lv;

import android.content.Context;

import java.util.List;

/**
 * ListView使用这个适配器
 * @param <T>
 */
public abstract class LvCommonAdapter<T> extends LvMultiItemTypeAdapter<T> {


    public LvCommonAdapter(Context context, List<T> mDatas, final int layoutId) {
        super(context, mDatas);
        addItemViewDelegate(new LvItemViewDelegate<T>() {
            @Override
            public int getItemViewLayoutId() {
                return layoutId;
            }

            @Override
            public boolean isForViewType(T item, int position) {
                return true;
            }

            @Override
            public void convert(LvViewHolder holder, T t, int position) {
                LvCommonAdapter.this.convert(holder, t, position);
            }
        });
    }

    protected abstract void convert(LvViewHolder viewHolder, T item, int position);

}
